package com.xzs.kit.base.model;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 * @author : Victor.Xiao
 * @date : 2017/12/08 10:37
 * @description :
 */
public class BaseModel implements Serializable,Cloneable {
    private static final long serialVersionUID = 1L;

    private Date createdAt;

    public Date getCreatedAt() {
//        if(this.createdAt == null) {
//            this.createdAt = DateUtil.getCurTime();
//        }
        return createdAt;
    }

    public Date refreshDate(){
        this.createdAt = new Date();
        return this.createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String generateId() {
        UUID uuid = UUID.randomUUID();
        String uuidStr = uuid.toString().replaceAll("-", "");
        return uuidStr;
    }

    @Override
    public Object clone(){
        try {
            return super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return null;
        }
    }
}
